// import { oneOf } from '../utils/assist';
export default {
  props: {
    to: {
      type: [Object, String],
      default () {
        return ''
      }
    }

  },
  computed: {},
  data() {
    return {
      loading: false,
      pageSize: 10,
      pageNum: 1,
      total: '0',
      showTotal: true,
      showSizer: true,
      pageSizeOpts: [10, 20, 50, 100]
    }
  },
  methods: {
    handleSubmit(name) {
      this.tableData = []
      if (name) {
        this.$refs[name].validate(valid => {
          if (valid) {
            this.loadAjax()
          } else {
            this.$Message.error('error')
          }
        })
      } else {
        this.loadAjax()
      }
    },
    handleReset() {
      this.$refs['searchForm'].resetFields()
      this.pageNum = 1
      this.tableData = []
      this.loadAjax() // 请求第一页
    },
    onChangePage(page, pageSize) {
      this.pageNum = page
      this.pageSize = pageSize || this.pageSize
      this.tableData = []
      this.loadAjax()
    }
  }
}
